<?php

/**
 * Transaction form base class.
 *
 * @package    form
 * @subpackage transaction
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseTransactionForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                 => new sfWidgetFormInputHidden(),
      'transactiontype_id' => new sfWidgetFormDoctrineChoice(array('model' => 'TransactionType', 'add_empty' => false)),
      'start_date'         => new sfWidgetFormDate(),
      'end_date'           => new sfWidgetFormDate(),
      'client_id'          => new sfWidgetFormDoctrineChoice(array('model' => 'Client', 'add_empty' => true)),
      'person_id'          => new sfWidgetFormDoctrineChoice(array('model' => 'Person', 'add_empty' => true)),
      'created_at'         => new sfWidgetFormDateTime(),
      'updated_at'         => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                 => new sfValidatorDoctrineChoice(array('model' => 'Transaction', 'column' => 'id', 'required' => false)),
      'transactiontype_id' => new sfValidatorDoctrineChoice(array('model' => 'TransactionType')),
      'start_date'         => new sfValidatorDate(array('required' => false)),
      'end_date'           => new sfValidatorDate(array('required' => false)),
      'client_id'          => new sfValidatorDoctrineChoice(array('model' => 'Client', 'required' => false)),
      'person_id'          => new sfValidatorDoctrineChoice(array('model' => 'Person', 'required' => false)),
      'created_at'         => new sfValidatorDateTime(array('required' => false)),
      'updated_at'         => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('transaction[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Transaction';
  }

}
